<!--
* description: 线索查询(UE翻写)
* author: dxuem
* createdDate: 2019-10-28
-->
<template>
  <div class="app-container app-container-table">
    <one-table-template
      ref="multipleTable"
      :dynamicButtons="tableButtons"
      :dynamicComponents="tableComponents"
      :dynamicSearchField="searchField"
      :dynamicApiConfig="apiConfig"
      :dynamicTableCols="tableCols"
      :dynamicFormFields="formField"
      :dynamicIsShowSelect="false"
      :dynamicIsShowMoreBtn="true"
    />
  </div>
</template>
<script>
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import { crmApis } from "@/api/apiList/crm";
import OneTableTemplate from "@/components/crm/Template/crmonePage";
export default {
  name: "ComplaintAssist",
  // 组件混入对象
  mixins: [oneTableWithViewTemplateMixins],
  components: {
    OneTableTemplate
  },
  data() {
    return {
      currentRow: null,
      apiConfig: crmApis.clueServerQueryFromHeadquarters,
      // 动态组件-查询条件
      tableComponents:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableComponents.length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableComponents
          : [
              {
                compKey: "compKey1",
                labelName: "客户名称",
                codeField: "custName",
                component: () => import("@/components/org/commonInput"),
                inputType: "inputText",
                isMust: false
              },
              {
                compKey: "compKey2",
                labelName: "电话",
                codeField: "contactTel",
                component: () => import("@/components/org/commonInput"),
                inputType: "inputText",
                isMust: false
              },
              {
                compKey: "compKey3",
                labelName: "作业状态",
                lookuptype: "LX182",
                codeField: "crruNode",
                component: () => import("@/components/org/LookupValue"),
                inputType: "dropdownlist",
                isMust: false
              },
              {
                compKey: "compKey4",
                labelName: "清洗状态",
                lookuptype: "LX810",
                codeField: "cleanFlag",
                component: () => import("@/components/org/LookupValue"),
                inputType: "dropdownlist",
                isMust: false
              },
              {
                compKey: "compKey5",
                labelName: "接触状态",
                lookuptype: "TOUCHSTATE",
                codeField: "touchStatus",
                component: () => import("@/components/org/LookupValue"),
                inputType: "dropdownlist",
                isMust: false
              },

              {
                compKey: "compKey6",
                labelName: "网点",
                isMul: false,
                codeField: "dlrCode",
                component: () =>
                  import("@/components/crm/crmEjectWindows/crmChangeDlr"),
                inputType: "inputText",
                isMust: false
              },
              {
                compKey: "compKey7",
                labelName: "批次号",
                codeField: "batchNo",
                component: () => import("@/components/org/commonInput"),
                inputType: "inputText",
                isMust: false
              },
              {
                compKey: "compKey8",
                labelName: "线索单号",
                codeField: "serverOrder",
                component: () => import("@/components/org/commonInput"),
                inputType: "inputText",
                isMust: false
              },
              {
                compKey: "compKey10",
                labelName: "车辆品牌",
                codeField: "carBrandCode",
                textField: "carBrandCn",
                lookuptype: crmApis.mdmCarBrandQueryByPage, //API或者值列表编码
                component: () =>
                  import("@/components/crm/lookupValue/apiDropList"), //导入的组件路径
                inputType: "dropdownlist",
                isMust: false
              },
              {
                compKey: "compKey9",
                labelName: "意向车系",
                lookuptype: "LX810",
                codeField: "inteSeriesId",
                component: () =>
                  import("@/components/crm/crmEjectWindows/crmIntenCarSeries"),
                inputType: "dropdownlist",
                isMust: false,
                emitCode:this.inteSeriesChange
              },

              {
                compKey: "compKey15",
                labelName: "建单日期",
                codeField: "createdDateStart,createdDateEnd",
                component: () =>
                  import("@/components/crm/Time/crmdtDatePicker"),
                dateType: "daterange",
                isMust: false
              },
              {
                compKey: "compKey11",
                labelName: "传输对象",
                lookuptype: "LX122",
                codeField: "transferObject",
                component: () => import("@/components/org/LookupValue"),
                inputType: "dropdownlist",
                isMust: false
              },
              {
                compKey: "compKey13", //KEY标识
                labelName: "接触方式", //label标签名称
                codeField: "cantactWayCode", //label下拉框code
                textField: "cantactWayName", //label下拉框中文
                lookuptype: crmApis.pcDbCantactWayQueryFindAll, //API或者值列表编码
                component: () =>
                  import("@/components/crm/lookupValue/singleDropList"), //导入的组件路径
                type: "dropdownList", //导入的组件类型
                isMust: false, //是否必填对应required
                isMul: false
              },
              {
                compKey: "cantactWayCode", //KEY标识
                labelName: "渠道大类", //label标签名称
                codeField: "infoChanMCode", //label下拉框code
                textField: "infoChanMName", //label下拉框中文
                lookuptype: crmApis.pcDbInfoChanMQueryFind, //API或者值列表编码
                changeCodeArray: [{ changCode: "cantactWayCode" }],
                component: () =>
                  import("@/components/crm/lookupValue/secondDropList"), //导入的组件路径
                type: "dropdownList", //导入的组件类型
                isMust: false, //是否必填对应required
                isMul: false
              },
              {
                compKey: "compKey14",
                labelName: "渠道小类名称",
                codeField: "infoChanDName",
                component: () => import("@/components/org/commonInput"),
                inputType: "inputText",
                isMust: false
              },
              // {
              //   compKey: "infoChanMCode",
              //   labelName: "渠道小类",
              //   codeField: "infoChanDCode",
              //   textField: "infoChanDName",
              //   lookuptype: crmApis.pcDbInfoChanDQueryFind,
              //   changeCodeArray: [{ changCode: "infoChanMCode" }],
              //   extralParams:{oemCode:'1',groupCode:'1',isPv: "1"},//参数
              //   component: () =>
              //     import("@/components/crm/lookupValue/secondDropList"), //导入的组件路径
              //   type: "dropdownList",
              //   isMust: false,
              //   isMul: false
              // },

            ],
      // 动态生成网格列
      tableCols:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols.length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          : [
              {
                prop: "controlBtn",
                label: "操作",
                codeField: "controlBtn",
                width: 120,
                align: "center",
                isComponent: true,
                fixed: true,
                comps: [
                  // {
                  //   compKey: "propKey1",
                  //   labelName: "详情",
                  //   codeField: "editControlBtn",
                  //   clickEvent: index => {
                  //     this.detail(index);
                  //   },
                  //   component: () => import("@/components/org/linkButton"),
                  //   align: "center"
                  // },
                  {
                    compKey: "propKey2",
                    labelName: "过程查看",
                    codeField: "editControlBtn",
                    clickEvent: index => {
                      this.process(index);
                    },
                    component: () => import("@/components/org/linkButton"),
                    align: "center"
                  }
                ]
              },
              {
                prop: "serverOrder",
                label: "线索单号",
                width: 230,
                showLink: true,
                clickEvent: index => {
                  this.detail(index);
                },
                align: "center",
                fixed: true
              },
              {
                prop: "custName",
                label: "客户名称",
                width: 110,
                align: "center",
                fixed: true
              },
              {
                prop: "contactTel",
                label: "电话",
                width: 150,
                align: "center",
                fixed: true
              },
              {
                prop: "carSeriesCn",
                label: "意向车系",
                width: 170,
                align: "center"
              },
              {
                prop: "carBrandName",
                label: "车辆品牌",
                width: 170,
                align: "center"
              },
              {
                prop: "dlrShortName",
                label: "网点",
                width: 170,
                align: "center"
              },

              {
                prop: "transferObjectName",
                label: "传输对象",
                width: 120,
                align: "center"
              },
              {
                prop: "batchNo",
                label: "批次号",
                width: 150,
                align: "center"
              },
              {
                prop: "touchStatusName",
                label: "接触状态",
                width: 150,
                align: "center"
              },
              {
                prop: "vin",
                label: "作业状态",
                width: 110,
                align: "center"
              },
              {
                prop: "cleanFlagName",
                label: "清洗状态",
                width: 110,
                align: "center"
              },

              {
                prop: "cantactWayName",
                label: "接触方式",
                width: 170,
                align: "center"
              },
              {
                prop: "infoChanMName",
                label: "渠道大类",
                width: 170,
                align: "center"
              },
              {
                prop: "infoChanDName",
                label: "渠道小类",
                width: 170,
                align: "center"
              },
              {
                prop: "createdDate",
                label: "建单日期",
                width: 150,
                align: "center"
              },
              {
                prop: "dlrCode",
                label: "网点编码",
                width: null,
                align: "center",
                hidden: true
              },
              {
                prop: "cleanFlag",
                label: "清洗状态",
                width: null,
                align: "center",
                hidden: true
              },
              {
                prop: "custId",
                label: "客户ID",
                width: null,
                align: "center",
                hidden: true
              }
            ],
      //是否显示table下面的组件
      isShowComponent: false,
      //表单查询数据
      formField: {
        createdDateStart: "",
        createdDateEnd: "",
        custName: "",
        contactTel: "",
        carBrandCode: "",
        dlrCode: "",
        serverOrder: "",
        transferObject: "",
        batchNo: "",
        touchStatus: "",
        inteSeriesId: "",
        cantactWayCode: "",
        cleanFlag: "",
        inteTypeCode: "",
        infoChanMCode: "",
        infoChanDCode: "",
        handleCode: "1",
        statusArray: ["0", "1", "3", "4", "5"],
        crruNode:"",
        infoChanDName:"",
      }
    };
  },
  methods: {
    inteSeriesChange(row){
      debugger
      this.formField.inteSeriesId=row[0].carSeriesId
    },
    //修改客户信息
    detail: function(rowData) {
      debugger;
      let that = this;
      //that.$router.push({ name: "ComplaintAssistHand", params: rowData });
      this.$crmcf.jumpDetailTag(
        that,
        "crmClueDetail",
        "/crmClueDetail",
        rowData
      );
    },
    process(index, rowData) {
      let that = this;
      //that.$router.push({ name: "ComplaintAssistHand", params: rowData });
      this.$crmcf.jumpDetailTag(
        that,
        "crmClueFollowHis",
        "/crmClueFollowHis",
        this.$refs.multipleTable.list[index]
      );
    }
  }
};
</script>
